﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CNVP.Framework;
using CNVP.JShop.UI;
using CNVP.Framework.Utils;

namespace CNVP.JShop.Web.Admin
{
    public partial class PayWay_TenPay_Edit : AdminPage
    {
        BLL.CNVP_Column bll = new BLL.CNVP_Column();
        Model.CNVP_Column model = new Model.CNVP_Column();
        public int id = 0;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!BLL.BLLCheckAdmin.LoginOk(Page, 104)) return;//判断页面权限
            id = 31;//财富通
            if (!IsPostBack)
            {
                if (id > 0)
                {
                    DataInfo(id);
                    lbTitle.Text = " > 修改";
                }
            }
        }

        public void DataInfo(int id)
        {
            model = bll.GetSingle_CNVP_ColumnById(id);
            if (model != null)
            {
                rblAlipayInInterfaceType.SelectedValue = model.AlipayInInterfaceType.ToString();
                txtColumnName.Text = model.ColumnName;
                txtPayAccountNumber.Text = model.PayAccountNumber;
                txtPayParterID.Text = model.PayParterID;
                txtPayKey.Text = model.PayKey;
                txtText.Text = model.Text;
                rblIsShow.SelectedValue = model.IsShow.ToString();
                txtOrderID.Text = model.OrderID.ToString();
            }
        }

        protected void btUp_Click(object sender, EventArgs e)
        {
            if (id > 0)
            {
                model.ID = id;
                model.AlipayInInterfaceType = byte.Parse(rblAlipayInInterfaceType.SelectedValue);
                model.ColumnName = txtColumnName.Text.Trim();
                model.PayAccountNumber = txtPayAccountNumber.Text.Trim();
                model.PayParterID = txtPayParterID.Text.Trim();
                model.PayKey = txtPayKey.Text.Trim();
                model.Text = txtText.Text.Trim();
                model.IsShow = byte.Parse(rblIsShow.SelectedValue);
                model.OrderID = int.Parse(txtOrderID.Text);
                int rows = bll.Update_CNVP_ColumnPayWay(model);
                if (rows == 1)
                {
                    BasePage.MessageBox("修改成功！", "PayWayList.aspx");
                }
                else
                { BasePage.MessageBox("修改失败！"); }
            }
        }
    }
}